<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function shu(a) {
            if (a == 1) {
                return false;
            }
            for (var i = 2; i < a; i++) {
                if (a % i == 0) {
                    return false;
                }
            }
            return true;
        }
        var x = prompt('请输入一个数字：');
        if (shu(x)) {
            alert('' + x + '是素数');
        } else {
            alert('' + x + '不是素数');
        }
    </script>
</head>

<body>

</body>

</html>